//
//  STShareAndFavorViewController.m
//  赛拓
//
//  Created by 王磊 on 7/31/16.
//  Copyright © 2016 立金所. All rights reserved.
//

#import "STShareAndFavorViewController.h"
//#import "BDShareView.h"
@interface STShareAndFavorViewController ()

@end

@implementation STShareAndFavorViewController

- (void)initSubviews {
    
    [super initSubviews];
    
    [self setRightBarItems];
}
- (void)setRightBarItems {
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [btn addTarget:self action:@selector(collect) forControlEvents:UIControlEventTouchUpInside];
    // 设置图片
    [btn setImage:[UIImage imageNamed:@"收藏"] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"已收藏"] forState:UIControlStateSelected];
    // 设置尺寸
    btn.k_size = CGSizeMake(20, 25);
    
    btn.imageEdgeInsets = UIEdgeInsetsMake(0, -15, -5, 0);
    
    self.collectItem = btn;
    
    UIBarButtonItem *collectItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    
    UIBarButtonItem *shareItem = [UIBarButtonItem itemRightOffsetWithTarget:self action:@selector(share) image:@"转发icon" highImage:@"转发icon"];
    UIBarButtonItem *spaceB = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    //左正右负
    spaceB.width = 20;
    
    self.navigationItem.rightBarButtonItems = @[shareItem,spaceB,collectItem];
    
}
- (void)collect {
    
    
}
- (void)share {
    //        BDShareView *shareView = [BDShareView shareView];
    //
    //        shareView.delegate = self;
    //
    //        shareView.datasource = self;
    //
    //        [shareView show];
    
}
#pragma mark ----- share view delegate  and data source

- (NSArray *)allTitles {
    
    return @[@"微信好友",@"微信朋友圈",@"QQ",@"微博",@"QQ空间",@"复制链接"];
}
- (NSArray *)allImageNames {
    return @[@"微信",@"微信朋友圈",@"qq",@"新浪微博",@"QQ空间",@"复制链接"];
}
- (void)onShareItemClick:(NSInteger)index {
    
}
//- (void)share:(SSDKPlatformType)platformType parameters:(NSMutableDictionary *)parameters {
//    [ShareSDK share:platformType parameters:parameters onStateChanged:^(SSDKResponseState state, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error) {
//        if (error) {
//            [SVProgressHUD showInfoWithStatus:@"未知错误"];
//        }else {
//            switch (state) {
//                case SSDKResponseStateSuccess:
//                    [SVProgressHUD showInfoWithStatus:@"分享成功"];
//                    break;
//                case SSDKResponseStateFail:
//                    [SVProgressHUD showInfoWithStatus:@"分享失败"];
//                    break;
//                case SSDKResponseStateCancel:
//
//                    break;
//                default:
//                    break;
//            }
//
//        }
//    }];
//}
@end
